package com.liuzhilong.infrastructure.framework.netty.api.standard.codec;

import com.liuzhilong.infrastructure.framework.netty.api.standard.command.Command;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

/**
 * command的编码器
 * @author longandai@163.com
 */
public class CommandEncoder extends MessageToByteEncoder<Command> {
    /**
     * 编码<br>
     * 编码逻辑参见代码{@link CommandCodec#encodeTo(Command, ByteBuf)}
     * @param ctx
     * @param msg
     * @param out
     * @throws Exception
     */
    @Override
    protected void encode(ChannelHandlerContext ctx, Command msg, ByteBuf out) throws Exception {
        CommandCodec.encodeTo(msg,out);
    }
}
